﻿from django.db import models
from django.contrib import admin
# Create your models here.

class reg(models.Model):
	name = models.CharField(max_length=50)
	sid = models.CharField(max_length=50)
	classno = models.CharField(max_length=50)
	phone = models.CharField(max_length=20)
	email = models.CharField(max_length=30)
	timestamp = models.DateTimeField(
					#auto_now=True,
					#auto_now_add=True
					)
	event = models.ForeignKey("event", related_name="event")
	sug = models.TextField()
	isChosen = models.BooleanField()
	class Meta:
		ordering = ['event', 'timestamp']
	def __unicode__(self):
		return self.name

class event(models.Model):
	name = models.CharField(max_length=80)
	uname = models.CharField(max_length=80)
	intro = models.TextField()
	begintime = models.DateTimeField()
	endtime = models.DateTimeField()
	sugtitle = models.CharField(max_length=80)
	class Meta:
		ordering = ['begintime','name']
	def __unicode__(self):
		return self.name

class regadmin(admin.ModelAdmin):
    list_display=('name','event','isChosen','timestamp')
	
class eventadmin(admin.ModelAdmin):
    list_display=('name','begintime')
	
admin.site.register(reg, regadmin)
admin.site.register(event, eventadmin)